<template>
  <div class="pie" ref="pieChart"></div>
</template>

<script>
export default {
  name: 'oa-pei',
  data () {
    return {
      option: {
        title: {
          text: '销售报表',
          subtext: '近一周',
          left: 'center'
        },
        tooltip: {
          trigger: 'item'
        },
        legend: {
          orient: 'vertical',
          left: 'left'
        },
        series: [
          {
            name: '销售额',
            type: 'pie',
            radius: '50%',
            data: [
              { value: 1048, name: '服饰' },
              { value: 735, name: '数码产品' },
              { value: 580, name: '家用电器' },
              { value: 484, name: '玩具' },
              { value: 300, name: '零食专区' }
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)'
              }
            }
          }
        ]
      }
    }
  },
  methods: {
    init () {
      const chartDom = this.$refs.pieChart
      const myChart = this.$echarts.init(chartDom)
      myChart.setOption(this.option)
    }
  },
  mounted () {
    window.onload = () => {
      this.init()
    }
  }
}
</script>
<style scoped lang="scss">
.pie{
  width: 800px;
  height: 500px;
  border: 1px solid black;
}
</style>
